package com.carbon.assets.mapper;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.carbon.assets.entity.CarbonCreditAssets;
import com.carbon.assets.entity.CarbonMetaregistry;
import com.carbon.assets.param.CarbonCreditAssetsQueryParam;
import com.carbon.assets.vo.CarbonAssetsTotalVo;
import com.carbon.assets.vo.CarbonCreditAssetsQueryVo;
import com.carbon.assets.vo.SelectorVo;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;

/**
 * <p>
 * 碳信用资产 Mapper 接口
 * </p>
 *
 * @author Li Jun
 * @since 2022-04-24
 */
@Repository
public interface CarbonCreditAssetsMapper extends BaseMapper<CarbonCreditAssets> {
    // 连表查询，直接接收 tenantId 参数
    List<CarbonCreditAssetsQueryVo> selectJoin(@Param("tenantId") String tenantId);



    IPage<CarbonMetaregistry> queryProjectList(Page<CarbonMetaregistry> pagination,
                                               @Param("projectName") String projectName,
                                               @Param("tenantId") Long tenantId);

    CarbonCreditAssets getByCarbonProjectId(Long projectId);

    void updateAmount(@Param(("projectId")) Long projectId,@Param("tradeQuantity") BigDecimal tradeQuantity);

    CarbonCreditAssetsQueryVo selectOneJoin(String id, String tenantId);

    //List<CarbonCreditAssetsQueryVo> selectJoinBySelector(SelectorVo selectorVo);

    Page<CarbonCreditAssetsQueryVo> selectBySelector( @Param("page") Page<CarbonCreditAssetsQueryVo> page,
                                                      @Param("query") SelectorVo selectorVo);
}
